<template>
	<view class="container">
		<form @submit="formSubmit">
			<textarea :placeholder="placeholder" :value="value" name="value"></textarea>
			<button :style="'background:' + mobile_head_color" class="block_btn" formType="submit">
				<lang keywords="确定"></lang>
			</button>
		</form>
	</view>
</template>

<script>
	import common from '../../../utils/common.js'
	var _this;
	var app = getApp();

	export default {
		data() {
			return {
				title: '',
				value: '',
				iswrite: 0,
				placeholder: '',
				config: '',
				mobile_head_color: ''
			};
		},

		onReady: function() {
			// 页面渲染完成
			wx.setNavigationBarTitle({
				title: common.changeTxt(this.title)
			});
		},
		onLoad: function(options) {
			// 页面初始化 options为页面跳转所带来的参数
			_this = this;
			var placeholder = '请填写' + options.title;
			var isWriteTxt = '可不填';

			if (options.iswrite == 1) {
				isWriteTxt = '必填';
			}

			_this.placeholder = common.changeTxt('请填写X1', {X1: common.changeTxt(options.title)}) + '（' + common.changeTxt(isWriteTxt) + '）'
			common.setMainColor(_this, function(config){
				_this.mobile_head_color = config.config.mobile_head_color
			});
			this.title = options.title
			this.value = options.value
			this.iswrite = options.iswrite
		},
		onShow () {
			// #ifdef H5
			common.hideWxShare()
			// #endif
		},
		methods: {
			formSubmit: function(e) {
				console.log(e.detail);
				wx.setStorageSync('order_value', e.detail.value.value);
				wx.navigateBack();
			}
		}
	};
</script>
<style>
	.container {
		padding: 20rpx 24rpx;
	}

	textarea {
		background: white;
		width: inherit;
		height: 260rpx;
		padding: 20rpx 24rpx;
	}
</style>
